import { Controller, Get } from '@nestjs/common';
import { TopologyService } from './topology.service';
import { ServiceNode } from '../entities/service-node.entity';
import { ServiceEdge } from '../entities/service-edge.entity';
import { createResponse } from '../common/response.interface';
import type { IResponse } from '../common/response.interface';

@Controller('topology')
export class TopologyController {
  constructor(private readonly topologyService: TopologyService) {}

  @Get()
  async getTopology(): Promise<IResponse<{ nodes: ServiceNode[]; edges: ServiceEdge[] }>> {
    const topology = await this.topologyService.getTopology();
    return createResponse(topology);
  }
}